]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Check that files with translatable strings are listed in POTFILES
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 18 Feb 2020 18:05:47 +0000 (19:05 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 26 Feb 2020 22:53:00 +0000 (22:53 +0000)
Also known as "Piotr Drąg Bot".

We will soon make sure that files processed by xgettext don't use template
strings. To make that check as adequate as possible, ensure that no source
code files are missing from POTFILES.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1016

.gitlab-ci.yml
.gitlab-ci/check-potfiles.sh [new file with mode: 0755]

index 6e58624440ddd3a28e76cbd8cd0f802831f06919..3b4d23ab9a3073a6e1a31a24d6df1fd9bad4dd8f 100644 (file)
@@ -46,6 +46,13 @@ eslint:
             - reports
         when: always
 
+potfile_check:
+    image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1
+    stage: review
+    script:
+        - ./.gitlab-ci/check-potfiles.sh
+    <<: *only_default
+
 build:
     image: registry.gitlab.gnome.org/gnome/mutter/master:v3
     stage: build
diff --git a/.gitlab-ci/check-potfiles.sh b/.gitlab-ci/check-potfiles.sh
new file mode 100755 (executable)
index 0000000..51cbdd8
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+srcdirs="js src subprojects/extensions-tool"
+globs=('*.js' '*.c')
+
+# find source files that contain gettext keywords
+files=$(grep -lR ${globs[@]/#/--include=} '\(gettext\|[^I_)]_\)(' $srcdirs)
+
+# find those that aren't listed in POTFILES.in
+missing=$(for f in $files; do ! grep -q ^$f po/POTFILES.in && echo $f; done)
+
+if [ ${#missing} -eq 0 ]; then
+  exit 0
+fi
+
+cat >&2 <<EOT
+
+The following files are missing from po/POTFILES.po:
+
+EOT
+for f in $missing; do
+  echo "  $f" >&2
+done
+echo >&2
+
+exit 1